package com.ehome.poct.base.api.enums;

import com.google.common.collect.Lists;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Arrays;
import java.util.List;
import java.util.Optional;

@Getter
@RequiredArgsConstructor
@AllArgsConstructor
public enum StripTypeEnums {

    CRP(4, "CRP检测"),
    SAA(5, "SAA检测"),
    BLD(100, "血常规三项检测", "R_REPORT", Lists.newArrayList()),
    FLUA_AG(16, "甲乙流"),
    HBA1C(12, "糖化血红蛋白"),
    MALB(11, "微量尿蛋白"),
    HMALB(21, "微量尿蛋白半定量"),
    SAA_CRP(18, "SAA双联试纸检测", "S_CRP_SAA_REPORT", null),
    SAA_CRP_SINGLE_PAPER(18, "SAA CRP单试纸（两张试纸）", "U_CRP_SAA_REPORT", null),
    U_CRP_SAA_BLD_REPORT(121, "CRP+SAA+血常规联合检测", "U_CRP_SAA_BLD_REPORT", Lists.newArrayList(4, 5, 100)),

    U_MPIGM_CPNIGM_REPORT(50, "肺支肺衣联合检测", "U_MPIGM_CPNIGM_REPORT", Lists.newArrayList(6, 17)),
    U_MP_AB_CPNIGM_REPORT(51, "肺支总抗肺衣联合检测", "U_MP_AB_CPNIGM_REPORT", Lists.newArrayList(9, 17)),
    DEFAULT_TYPE(-9999, "业务上使用，跟检查项没有关系");

    private final Integer stripTypeCode;
    private final String desc;
    private String reportTypeCode;
    private List<Integer> combinationCodeList;


    public static StripTypeEnums getStripType(Integer stripTypeCode) {
        Optional<StripTypeEnums> optional = Arrays.stream(StripTypeEnums.values())
                .filter(stripTypeEnums -> stripTypeEnums.getStripTypeCode().equals(stripTypeCode)).findFirst();
        if (optional.isEmpty()) {
            return DEFAULT_TYPE;
        }
        return optional.get();
    }
}
